Welcome Guest | Sign in | Register
Java Basics - Java Programming Interview Questions and Answers | LucentBlackBoard | LucentBlackBoard.com

Home > Technical Interviews > Computer Science & Engineering > Java Programming > Java Basics Questions and Answers

11. What if the main() method is declared as private?

The program compiles properly but at runtime it will give "main() method not public." message.

12. What if the static modifier is removed from the signature of the main() method?

Program compiles. But at runtime throws an error "NoSuchMethodError".

13. What if I write static public void instead of public static void?

Program compiles and runs properly.

14. What if I do not provide the String array as the argument to the method?

Program compiles but throws a runtime error "NoSuchMethodError".

15. Program compiles but throws a runtime error "NoSuchMethodError".

The String array is empty. It does not have any element. This is unlike C/C++ where the first element by default is the program name.




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.